package com.smart.controller;

import java.io.IOException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class DispatcheServlet
 * <p>用于拦截所有请求</p>
 */
/**
 * @param urlPatterns 拦截所有请求
 * @author CrazyShaQiuShi
 * @param loadOnStartup 设置项目启动就加载
 */
@WebServlet(urlPatterns="/*",loadOnStartup=0)
public class DispatcheServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public DispatcheServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see Servlet#init(ServletConfig)
	 */
	public void init(ServletConfig config) throws ServletException {
		System.err.println("初始化请求，加载所有扫描到注解到容器中");
	}

	@Override
	protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
		System.err.println("每次拦截到的请求，依据请求的路径不同进行分发");
		
	}
}
